package com.study.strategy;

import com.study.common.enums.PrintTypeEnum;
import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentHashMap;

/**
 * 打印模板策略工厂
 * @author hw
 * @date 2022/11/2 11:07:50
 */
@Component
public class PrintTemplateStrategyFactory {

    private static ConcurrentHashMap<PrintTypeEnum, PrintTemplateStrategy> map = new ConcurrentHashMap<>();

    public static PrintTemplateStrategy getHandler(PrintTypeEnum printTypeEnum) {
        return map.get(printTypeEnum);
    }

    public static void setHandler(PrintTypeEnum printTypeEnum, PrintTemplateStrategy exchangeStrategy) {
        map.put(printTypeEnum, exchangeStrategy);
    }

}
